home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ian & Stuart's Australian Mac: Not for Sale
/
Another.not.for.sale (Australia).iso
/
fade into you
/
getting there
/
WWW
/
MacHTTP Extras
/
map demo
/
cat_map.script
< prev
next >
Wrap
Text File
|
1994-05-11
|
2KB
|
49 lines
-- Uncomment the following "on" line if you want to compile this script as an application.
-- The script should be renamed to cat_map.exe and the HTML docs should be changed accordingly
--on «event WWWΩsrch» http_search_args
-- Change the following line to be the domain name or IP address of your MacHTTP server
set this_server_addr to "oac2.hsc.uth.tmc.edu"
set crlf to (ASCII character 13) & (ASCII character 10)
--this is a normal HTTP header returned when this script generates HTML for return
-- to the server.
set http_10_header to "HTTP/1.0 200 OK" & crlf & "Server: MacHTTP" & crlf & ¬
"MIME-Version: 1.0" & crlf & "Content-type: text/html" & crlf & crlf
--header used for URL redirects
set redirect_head to "HTTP/1.0 302 Found" & crlf & "Location: http://" & this_server_addr & "/map%20demo/"
--doc to return to on the off chance that something screws up.
set parent_doc to "HTTP/1.0 302 Found" & crlf & "Location: http://" & this_server_addr & "/map%20demo/cat_map.html"
if http_search_args = "" then
return parent_doc
else
set comma to offset of "," in http_search_args
set theLast to count http_search_args
set x to (text 1 thru (comma - 1) of http_search_args) + 0
set y to (text (comma + 1) thru theLast of http_search_args) + 0
end if
if x < 60 and y < 100 then
--Top Left - shows how to write an AppleScript that loads HTML directly from a file.
return http_10_header & "<img src=dead_cat_tl.gif>Sorry, this example doesn't work as promised."
else if y < 100 then
--Top Right - demonstrates using URL redirection and scripts to zoom in on the map for more detail.
return redirect_head & "cat_map_tr.html"
else if x < 60 then
--Bottom Left - shows how to open a larger GIF image using URL redirection.
return redirect_head & "dead_cat_bl.gif"
else
--Bottom Right - demos generating HTML on the fly from AppleScript.
return http_10_header & "<title>Generated HTML</title><h2>This HTML was generated by AppleScript!</h2>"¬
& "<A HREF=cat_map.script><IMG SRC=dead_cat_map.gif ismap></A> Click the kitty again."
end if
--uncomment the following line if the script is saved as an application
--end «event WWWΩsrch»